package 力扣日常刷题.木22二月.第18天224;

import java.util.Scanner;

/**
 * @author 帅小伙
 * @date 2022/2/24
 * @description
 * 50%
 */
public class Demo144字节跳动2018校招后端方向第二批1 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        int m = scanner.nextInt();
        while (m-- != 0) {
            int l = scanner.nextInt(),r = scanner.nextInt(),k = scanner.nextInt();
            int ans = 0;
            for (int i = l - 1; i < r; i++){
                if(arr[i] == k) ++ans;
            }
            System.out.println(ans);
        }
    }

}
